package at.ltasat;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Configuration {
	private InputStream in;
	private OutputStream out;
	private OutputStream err;
	private File file;

	{
		in = System.in;
		out = System.out;
		err = System.err;
	}

	public boolean isInFile() {
		return file != null;
	}

	public InputStream getIn() throws IOException {
		return in != null ? in : (in = new FileInputStream(file));
	}

	public File getInFile() {
		return file;
	}

	public OutputStream getOut() {
		return out;
	}

	public OutputStream getErr() {
		return err;
	}

	public void setIn(InputStream in) {
		assert in != null;
		this.in = in;
		this.file = null;
	}

	public void setIn(File file) {
		assert file != null;
		this.file = file;
		this.in = null;
	}

	public void setOut(OutputStream out) {
		assert out != null;
		this.out = out;
	}

	public void setErr(OutputStream err) {
		assert err != null;
		this.err = err;
	}
}
